<?php

namespace App\Http\Controllers\Weixin;

use App\Http\Controllers\Controller;
use EasyWeChat\Foundation\Application;

class MenuController extends Controller
{
    /**
     * 展示给定用户的信息。
     *
     * @param  int  $id
     * @return Response
     */
    public function index()
    {
        $options = [
            'debug'  => true,
            'app_id' => 'wxec85aea7e167cca2',
            'secret' => '987095cd9957af1771e97eab081e966e',
            'token'  => 'hello1001',
            'aes_key' => 'a7vueMQrygabKrlNHZri4kUnxatx6qQREEeSBOwhcuh', // 可选
            'log' => [
                'level' => 'debug',
                'file'  => '/tmp/easywechat.log', // XXX: 绝对路径！！！！
            ],
        ];
        $app = new Application($options);
        $menu = $app->menu;
        $buttons = [
            [
                "type" => "view",
                "name" => "客户维护",
                "url"  => "http://weixin.fmntt.com"
            ],
        ];
        $menu->add($buttons);
        // $menu->destroy(); // 全部

    }
}